package com.damionew.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.damionew.model.User;
import com.damionew.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {
	@Autowired
	private UserService userService;

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	@RequestMapping("/Info")
	public String userInfo(Model model) {
		List<User> list = userService.getUserInfo();
		System.out.println(list.get(0).getUsername());
		System.out.println(list.get(0).getUserpass());
		String username = list.get(0).getUsername();
		model.addAttribute("username", username);
		return "userInfo";
	}
	
}
